package ch03;

public class Corn extends Crop {
    private double harvestCost;

    public Corn() {this(50);
    }

    public Corn(double harvestCost) {
        super("玉米",8,3,200,"生长期",false);
        this.harvestCost = harvestCost;
    }

    public Corn(String name, int growTime, int harvestTime, int numsOfFruits, double harvestCost) {
        super(name, growTime, harvestTime, numsOfFruits);
        this.harvestCost = harvestCost;
    }

    public double getHarvestCost() {
        return harvestCost;
    }

    public void setHarvestCost(double harvestCost) {
        this.harvestCost = harvestCost;
    }

    /**
     * 输出玉米特性
     */
    @Override
    public void print(){
        //3父+1子    0父+N子
        super.print();
        System.out.println(this.getName() +"属于农作物，收割费用为："+this.harvestCost+"元。");
    }

    /**
     * 生长报告
     * @param day 生长的天数
     */
    @Override
    public void printGrowReport(int day){
        super.printGrowReport(day);
    }

    /**
     * 采摘
     */
    @Override
    public void harvest(){
        boolean isHarvested = this.isHarvested();
        super.harvest();
        if (this.getStatus() == "采摘期") {
            if (!isHarvested) {
                System.out.println("使用收割机收割"+ this.getName() +"，费用："+this.harvestCost+"元。");
            }
        }
    }
    public void reHarvester(double cost){
        if (this.harvestCost == cost){
            System.out.println("更换收割机后，费用不变！");
        }else{
            this.harvestCost = cost;
            System.out.println("更换收割机后，费用变为"+this.harvestCost+"。");
        }
    }
}
